using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
class Program
{
    static void Main()
    {
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        int c = int.Parse(Console.ReadLine());
        int d = int.Parse(Console.ReadLine());
        int e = int.Parse(Console.ReadLine());
 
        int leastcommonmultiple = 100000;
 
        for (int i = 1000000; i > 0; i--)
        {
            int counter = 0;
 
            if (i % a == 0)
            {
                counter++;
            }
            if (i % b == 0)
            {
                counter++;
            }
            if (i % c == 0)
            {
                counter++;
            }
            if (i % d == 0)
            {
                counter++;
            }
            if (i % e == 0)
            {
                counter++;
            }
 
            if (counter>=3)
            {
                leastcommonmultiple = i;
            }
 
        }
 
        Console.WriteLine(leastcommonmultiple);
    }
}